package com.zcbl.toolkit.spring;

import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;



/**
 * @author he peng
 * @create 2018/5/7 13:17
 * @see
 */

@Configuration
@ConditionalOnClass(ApplicationContext.class)
public class ApplicationContextHolderAutoConfiguration {


    @Bean
    public ApplicationContextHolder applicationContextHolder(ApplicationContext applicationContext) {
        ApplicationContextHolder.setApplicationContext(applicationContext);
        return new ApplicationContextHolder();
    }
}
